#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

sh_file=$PWD/$0
sh_path=$(dirname $sh_file)
app_path=$(dirname $sh_path)
env_file=$sh_path/.env
function get_config()
{
  param=$1
  value=$(sed -E '/^#.*|^ *$/d' $env_file | awk -F "${param}=" "/${param}=/{print \$2}" | tail -n1)
  echo $value
}
tmp=$sh_path/tmp
system=$(get_config system)
app_name=$(get_config app_name)
docker_path=$(get_config docker_path)
project_name=$(get_config project_name)

echo '当前编译环境为: '$system
echo '当前项目为: '$project_name
if [ $system == 'docker' ];then
  echo 'docker 环境'
  echo $docker_path
  # docker exec -w $run node14 nohup npm run dev >/dev/null 2>&1 & exit
  docker exec -w $docker_path node14 nohup npm run dev 
elif [ $system == 'linux' ];then
  echo 'linux 环境'
elif [ $system == 'win' ];then
  echo 'win 环境'
fi



